/**
 * 
 */
package com.angel.configuration.initializer.impl;

import com.angel.architecture.persistence.beans.ConfigurationParameter;
import com.angel.common.helpers.ReflectionHelper;
import com.angel.configuration.initializer.ConfigurationInitializer;
import com.angel.io.processors.commands.exports.ExportFileProcessorCommand;
import com.angel.webapp.application.ApplicationExportFileCommands;

/**
 * @author William
 *
 */
public class ExportStrategiesInitializer extends ConfigurationInitializer{

	private static final String EXPORT_STRATEGIES_AREA_NAME = "ExportsStrategies";

	@Override
	public boolean appliesConfiguration(ConfigurationParameter cp) {
		return cp != null && cp.isForParameterArea(EXPORT_STRATEGIES_AREA_NAME);
	}

	@Override
	public void addConfiguration(ConfigurationParameter cp) {
		ExportFileProcessorCommand exportFileProcessorCommand = (ExportFileProcessorCommand) ReflectionHelper.createObject(cp.getStringValue());
		ApplicationExportFileCommands.createInstance().addExportFileCommand(cp.getName(), exportFileProcessorCommand);
	}
	
}
